<!DOCTYPE html>
<html>
<head>
  <script src="../../js-test-resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<p>This test checks the behavior of loading on back navigation. Back-forward
cache needs to be disabled to test the behavior, because otherwise we won't
trigger a new load on back navigation.
</p>

<div id="console"></div>

<script>
description('Tests that loading is not stopped by going forward to a fragment.');

onload = function()
{
    if (window.localStorage.stage == 'three') {
        console.log('3. Got back to start.  Going forward to page 2.');
        window.localStorage.stage = 'four';
        history.forward();
    } else if (window.localStorage.stage == 'six') {
        delete window.localStorage.stage;
        finishJSTest();
    } else {
        // To make sure that we hit this branch, log this to the console so that
        // it shows up in expected output (debug() will be blown away once we
        // navigate out).
        console.log('Starting test.');
        window.localStorage.stage = 'one';
        // Navigate in a timeout to make sure we create a history entry.
        setTimeout(function() {
            window.location.href = 'resources/forward-to-fragment-fires-onload-2.html';
        }, 0);
    }
};

var jsTestIsAsync = true;
</script>

</body>
</html>
